/**
 * 
 */
package com.yss.sofa.ide.builder.dbscript.ui.wizard;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;

import com.yss.sofa.ide.builder.dbscript.model.ScriptInfo;
import com.yss.sofa.ide.builder.dbscript.ui.composite.ImportSourceType;
import com.yss.sofa.ide.ui.wizard.BaseWizardPage;

/**
 * @author huangsq
 * @version 1.0, 2013-11-15
 * @since 1.0, 2013-11-15
 */
public class ImportSourceTypePage extends BaseWizardPage {

  public static final String ID = "ImportSourceTypePage";

  private ScriptInfo info;
  private ImportSourceType importSourceType;

  /**
   * Create the wizard.
   */
  public ImportSourceTypePage(ScriptInfo info) {
    super(ID);
    setTitle(Messages.ImportSourceTypePage_TITLE);
    setDescription(Messages.ImportSourceTypePage_DESC);
    this.info = info;
  }

  /**
   * Create contents of the wizard.
   * 
   * @param parent
   */
  @Override
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);

    container.setLayout(new GridLayout(1, false));

    this.importSourceType = new ImportSourceType(container, this, this.info, SWT.NONE);
    this.importSourceType.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    setControl(container);
    setPageComplete(validatePage());

  }

  public boolean validate() {
    return this.importSourceType.validatePage(this);
  }

}
